﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[RequireComponent(typeof(RawImage))]
public class ButtonSwitchPic : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
    private RawImage rawImage;
    public Texture normalTex;
    public Texture hoverTex;

    private void Start()
    {
        rawImage = GetComponent<RawImage>();
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        if (hoverTex != null) {
            rawImage.texture = hoverTex;
        }
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        if (normalTex != null)
        {
            rawImage.texture = normalTex;
        }
    }

}
